@layout("/backend/common/_container.html"){
<div class="dhcc-form xs" id="dictInfoForm">
    <div class="row">
        <div class="col-sm-12" id="itemsArea">
            <input type="hidden" id="itemSize" value="${subDicts.~size!0}" />
            <div class="well form-group margin-0" id="dictInfoForm">
                <div class="row btn-margin-bottom">
                    <label class="col-sm-1 control-label">编码</label>
                    <div class="col-sm-4">
                        <input class="textbox" id="code" name="code" type="text" value="${dict.code}">
                    </div>
                    <label class="col-sm-1 control-label">名称</label>
                    <div class="col-sm-4">
                        <input class="textbox" id="name" name="name" type="text" value="${dict.name!}">
                        <input type="hidden" id="id" value="${dict.id}">
                    </div>
                    <div class="col-sm-2">
                        <#Button btnCss="l-bt-green" name="增加" icon="fa fa-plus" clickFun="DictInfoDlg.addItem()"/>
                    </div>
                </div>
                <div class="row btn-margin-bottom">
                    <label class="col-sm-1 control-label">分类</label>
                    <div class="col-sm-4">
                        <input class="textbox" id="categoryName" name="categoryName"
                               type="text" readonly="readonly" value="${dict.categoryName!}"
                               onclick="DictInfoDlg.showCategorySelectTree();"/>
                        <div id="pTreeDiv" style="display: none; position: absolute; z-index: 200;">
                            <ul id="pTree" class="ztree tree-box" style="width:244px !important;"></ul>
                        </div>
                        <input type="hidden" id="categoryId" name="categoryId" value="${dict.categoryId!}"/>
                    </div>
                    <label class="col-sm-1 control-label">排序</label>
                    <div class="col-sm-4">
                        <input class="textbox" id="weight" name="weight" type="text" value="${dict.weight!}">
                    </div>
                </div>
                <div class="row">
                    <label class="col-sm-1 control-label">备注</label>
                    <div class="col-sm-9">
                        <input class="textbox" id="description" name="description" type="text" value="${dict.description!}">
                    </div>
                </div>
            </div>
            <div class="hr-line-dashed"></div>
            @for(item in subDicts){
            <div class="form-group" name="dictItem" id="dictItem${itemLP.index}">
                <div class="col-xs-12">
                    <label class="col-sm-1 control-label">值</label>
                    <div class="col-sm-3">
                        <input class="textbox" type="text" name="itemKey" value="${item.key}">
                    </div>
                    <label class="col-sm-1 control-label" style="width: 8%;">名称</label>
                    <div class="col-sm-3">
                        <input class="textbox" type="text" name="itemName" value="${item.name}">
                    </div>
                    <label class="col-sm-1 control-label">排序</label>
                    <div class="col-sm-2">
                        <input class="textbox" type="text" name="itemWeight" value="${item.weight}">
                    </div>
                    <div class="col-sm-1">
                        <button class="btn btn-sm btn-danger" name="删除" id="cancel" onclick="DictInfoDlg.deleteItem(event)">删除</button>
                    </div>
                </div>
            </div>
            @}
        </div>
    </div>
    <div class="toolbar">
        <div class="col-sm-12">
            <#Button name="保存" id="ensure" icon="icon-w-save" clickFun="DictInfoDlg.editSubmit()"/>
            <#Button btnCss="l-bt-red" name="关闭" id="cancel" icon="icon-w-close" clickFun="DictInfoDlg.close()"/>
        </div>
    </div>
</div>

<script type="text/template" id="itemTemplate">
    <div class="form-group" name="dictItem" id="dictItem">
        <div class="col-xs-12">
            <label class="col-sm-1 control-label">值</label>
            <div class="col-sm-3">
                <input class="textbox" type="text" name="itemKey">
            </div>
            <label class="col-sm-1 control-label" style="width: 8%;">名称</label>
            <div class="col-sm-3">
                <input class="textbox" type="text" name="itemName">
            </div>
            <label class="col-sm-1 control-label" style="width: 8%;">排序</label>
            <div class="col-sm-2">
                <input class="textbox" type="text" name="itemWeight" value="0">
            </div>
            <div class="col-sm-1">
                <button class="btn btn-sm btn-danger" id="cancel" onclick="DictInfoDlg.deleteItem(event)">删除</button>
            </div>
        </div>
    </div>
</script>

<script src="${ctxPath}/static/backend/system/dict/dict_info.js"></script>
@}